home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / Gui4Cli / Docs / Tutorials / ListViews2.gc < prev    next >
Encoding:
Gui4CLI script  |  1980-01-03  |  1.8 KB  |  61 lines

  1. G4C
  2.  
  3. ; MULTISELECT LISTVIEWS
  4.  
  5. ; This is an example of multiselect listviews.
  6. ; Here again we have to give a file name which the listview will
  7. ; display.
  8.  
  9. ; We'll display the "guis:docs/printme" file in one and nothing in
  10. ; the other. The buttons transfers the selected lines
  11.  
  12.  
  13. WINBIG -1 -1 412 192   ListViews2.gc
  14. WinType 11110001
  15.  
  16. xOnLoad
  17. GuiOpen ListViews2.gc
  18.  
  19. xOnClose
  20. GuiQuit ListViews2.gc
  21.  
  22.  
  23. ; -------------------- Our listviews
  24.  
  25. ; Note that a multiselect lv will "happen" whenever the user double
  26. ; clicks on an item. Here, we'll not do anything when the user
  27. ; double clicks.. (that's why the lv's don't have any commands attached)
  28.  
  29. ; The left side listview
  30.  
  31. XLISTVIEW 4 2 225 188  "" left.lv "guis:docs/printme" 10 MULTI
  32. gadid 1
  33.  
  34.  
  35. ; The right side listview (no file)
  36.  
  37. XLISTVIEW 233 26 175 164  "" right.lv "" 10 MULTI
  38. GadID 2
  39.  
  40. ; -------------------- The button transfers the selected items..
  41.  
  42. ; to do this we have to use the lvmulti command to see which of the
  43. ; lines in the left listview have been selected. We use the internal
  44. ; variables to get our results - yes.. go read all about them..
  45.  
  46.  
  47. XBUTTON 232 3 119 20  "Copy --->>"
  48. lvuse listviews2.gc 1            ; use the left listview
  49. lvmulti first                    ; get the first selected record
  50. while $$lv.line > ''             ; while there *are* selected items
  51.    dummy = $$lv.rec              ; store the selected line into a variable
  52.    lvuse listviews2.gc 2         ; use the other listview
  53.    lvadd $dummy                  ; append the line to it
  54.    lvuse listviews2.gc 1         ; use our listview again
  55.    lvmulti off                   ; unselect the line we just transfered
  56.    lvmulti next                  ; get the next selected line
  57. endwhile                         ; .. until there are no more - i.e., until
  58.                                  ; the $$lv.line internal variable = ''
  59.  
  60.  
  61.